// miniprogram/pages/pdd/padd.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    list: []
  },
  toPdd: function () {
    console.log('跳转拼多')
    wx.navigateToMiniProgram({
      appId: 'wx32540bd863b27570'
    })
  },
  toMaoYan: function () {
    console.log('跳转猫眼')
    wx.navigateToMiniProgram({
      appId: 'wxdbb4c5f1b8ee7da1',
      path: 'pages/bargain/detail/index?activity_id=12254903&goods_id=746'
    })
  },
  toKoala: function () {
    console.log('跳转考拉')
    wx.navigateToMiniProgram({
      appId: 'wx9180a45a676eed94'
    })
  },
  toKoalaDetail: function () {
    console.log('跳转考拉')
    let goodsId = 2735158
    wx.navigateToMiniProgram({
      appId: 'wx9180a45a676eed94',
      path: `/package-product/pages/index?goodsId=${goodsId}&unionId=zhuanke_700019627&showWapBanner=0&rd=259200000`
    })
  },
  toKoalaListDetail: function (event) {
    // console.log(event)
    let goodsId = event.currentTarget.dataset.url
    console.log(goodsId)
    wx.navigateToMiniProgram({
      appId: 'wx9180a45a676eed94',
      path: `/package-product/pages/index?goodsId=${goodsId}&unionId=zhuanke_700019627`
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

    var self = this
    var Product = new wx.BaaS.TableObject(59948)
    var query = new wx.BaaS.Query()

    Product.limit(50).offset(0).find().then(res => {
      console.log(res)
      self.setData({ list: res.data.objects })
    }, err => {
      // err
    })
    
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})